package catgory;

import io.swagger.models.auth.In;

/**
 * describe:
 * 1-上传中 2-上传失败	3-排队中 -4待解析 4-解析中 5-解析失败 -6-待存储  6-存储中-7 已完成-8已终止
 *
 * @author huxingjie
 * @date 2019/04/03
 * @since 3.6
 */
public enum JobStatusType {

    UPLOADING(1, "上传中"),
    UPLOADFAILED(2, "上传失败"),
    QUEUEING(3, "排队中"),
    PENDINGANALYSIS(-4, "待解析"),
    INPARSING(4, "解析中"),
    PARSINGFAILURE(5, "解析失败"),
    INSTORAGE(6, "存储中"),
    PENDINGSTORAGE(-6, "待存储"),
    COMPLETED(7, "已完成"),
    TERMINATED(8, "已终止");

    JobStatusType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    int type;
    String name;


    public static JobStatusType getByType(int type) {
        for (JobStatusType jst : JobStatusType.values()) {
            if (jst.type == type) {
                return jst;
            }
        }
        return null;
    }

    public static JobStatusType getByName(String name) {
        for (JobStatusType jst : JobStatusType.values()) {
            if (jst.name .equals(name)) {
                return jst;
            }
        }
        return null;
    }
    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        Integer  i =1;
        System.out.println(i.equals(JobStatusType.getByName("上传中").getType()));

    }
}

    